<template>
    <a-card class="general-card" title="首检">
        <a-form v-model="checkForm" class="formHeader" >
            <a-row justify="start" :gutter="24">
            <a-col class="formHeader-criteria">
                <a-row :gutter="16">
                    <a-col span="8">
                        <a-form-item label="品号" label-col-flex="100px">
                        <a-input v-model="checkForm.article" allow-clear />
                        </a-form-item>
                    </a-col>
                    <a-col span="8">
                        <a-form-item label="编号" label-col-flex="100px">
                        <a-input v-model="checkForm.code" allow-clear />
                        </a-form-item>
                    </a-col>
                    <a-col span="8">
                        <a-form-item label="员工编号" label-col-flex="100px">
                        <a-input v-model="checkForm.codeid" readonly />
                        </a-form-item>
                    </a-col>
                </a-row>
                <a-row :gutter="16">
                    <a-col span="8">
                        <a-form-item label="工艺" label-col-flex="100px">
                        <a-input v-model="checkForm.gy" allow-clear @keyup.enter="selectUserMsg" />
                        </a-form-item>
                    </a-col>
                    <a-col span="8">
                        <a-form-item label="设备编码" label-col-flex="100px">
                        <a-input v-model="checkForm.mv002" allow-clear @keyup.enter="selectUserMsg" />
                        </a-form-item>
                    </a-col>
                    {{timeInterval}}
                    <a-col span="8">
                        <a-form-item label="日期区间选择" label-col-flex="100px">
                        <a-range-picker
                            @change="onChange"
                            @select="onSelect"
                            style="width: 254px; "
                            v-model="checkForm.timeInterval"
                        />
                        </a-form-item>
                    </a-col>
                </a-row>
            </a-col>
            <a-col class="formHeader-btn">
                <a-space direction="vertical" :size="20">
                <a-button type="primary" @click="selectDataListFun">
                    <template #icon>
                    <icon-search />
                    </template>
                    <template #default>查询</template>
                </a-button>
                <a-button @click="resetData">
                    <template #icon>
                    <icon-loop />
                    </template>
                    <template #default>重置</template>
                </a-button>
                </a-space>
            </a-col>
            </a-row>
        </a-form>
      <div class="user-area">
        <vxe-table
            border
            height="100%"
            size="mini"
            :loading="loadingData"
            :data="tableData">

            <vxe-column field="singetsu" title="单别" width="120" align="center"></vxe-column>
            <vxe-column field="odd" title="单号" width="120" align="center"></vxe-column>
            <vxe-column field="zx" title="中作中心" width="120" align="center"></vxe-column>
            <vxe-column field="time" width="120" title="生产日期" align="center"></vxe-column>
            <vxe-column field="shijian" width="120" title="检验时间" align="center"></vxe-column>
            <vxe-column field="pinhao" title="品号" width="120" align="center"></vxe-column>
            <vxe-column field="gx" title="工序" width="120" align="center"></vxe-column>
            <vxe-column field="gy" title="工艺" width="120" align="center"></vxe-column>
            <vxe-column field="scx" title="生产线" width="120" align="center"></vxe-column>
            <vxe-column field="sbm" title="设备编码" width="120" align="center"></vxe-column>
            <vxe-column field="gy" title="工艺说明" width="120" align="center"></vxe-column>
            <vxe-column field="status" title="状态" width="120" align="center"></vxe-column>
            <vxe-column field="" title="操作" align="center" width="150" fixed="right">
                <template #default="{ row  }">
                    <a-space>
                        <a-button :disabled="row.status=='已取消'" type="primary" size="mini" @click="viewDetails(row)">查看</a-button>
                      <a-button :disabled="row.status=='已取消'" type="primary" size="mini" status="danger" @click="cancelInspection(row)">取消检验</a-button>
                        <!-- <a-button type="primary" size="mini" status="danger" @click="del(row, rowIndex)">取消</a-button> -->
                    </a-space>
                </template>
            </vxe-column>
        </vxe-table>
      </div>
        <vxe-pager
            size="mini"
            v-model:current-page="pagination.current"
            v-model:page-size="pagination.pageSize"
            background
            :total="pagination.total"
            :layouts="['Home', 'PrevJump', 'PrevPage', 'JumpNumber', 'NextPage', 'NextJump', 'End', 'Sizes', 'FullJump', 'Total']"
            @page-change="getTableData"
        >

      </vxe-pager>

    </a-card>
</template>

<script lang="ts">
import { toRefs } from 'vue';
import importConfig from './firstInspection';

export default {
    setup() {
        const {
            base,
            onChange,
            selectDataListFun,
            getTableData,
            viewDetails,
            resetData,
          cancelInspection,
        } = importConfig();

        return {
            ...toRefs(base),
            onChange,
            selectDataListFun,
            getTableData,
            viewDetails,
            resetData,
          cancelInspection,
        };
    },
};
</script>

<style lang="less" scoped>
:deep(.arco-card-header) {
  border-bottom: none;
}
:deep(.arco-card-header-title) {
  text-align: left;
}
:deep(.arco-card-body){
    padding: 10px 16px;
}
.formHeader {
    &-buttom {
        padding: 10px 0px;
        display: flex;
        align-items: flex-end;
        align-content: flex-end;
        justify-content: flex-end;
    }

    &-criteria {
        flex: 1 1 0;
        &-postizz {
            display: flex;
            justify-content: flex-end;
            margin-top: 25px;
        }
    }

    &-btn {
        border-left: 1px solid #ddd;
        flex: 0 0 86px;
        text-align: right;
    }
}

:deep(.arco-divider-horizontal) {
    margin: 10px 0;
}

.add-user-btn {
    display: flex;
}

.user-area {
    margin-top: 20px;
    height: calc(100vh - 390px);

    :deep(.arco-table-td-content) {
        text-align: center;
    }
}
:deep(.arco-form-item){
    margin-bottom: 10px;
}
</style>
